package ddemo.viewAndcontroller;

import ddemo.service.UserService;
import ddemo.test.test;
import ddemo.util.MD5Utils;

import java.util.Scanner;

public class registerView {
    public static void zhuce(){
        Scanner sc=new Scanner(System.in);
        while (true) {
            System.out.println("请输入您要注册的账号");
            String username = sc.next();
            if (!UserService.isHave(username)) {
                System.out.println("该用户名已存在,请重试");
                continue;
            }
            System.out.println("请输入您要注册的密码");
            String password = sc.next();
            System.out.println("请输入您的电话号码");
            String phone_number = sc.next();
            int num=UserService.register(username, MD5Utils.getPWD(password),phone_number);
            System.out.println("注册成功,5s后跳转回页面");
            try {
                Thread.sleep(5000);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            break;
        }
        test.initial();

    }
}
